function *Generator() {
  yield 'Hello'
  yield 'world'
  return 'end'
}
var gen = Generator()
while(!gen.next().done) {
  console.log(gen.next())
}


var gen = Generator()
do {
  console.log(gen.next())
} while (!gen.next().done);

var gen = Generator()
for (const iterator of gen) {
  console.log(iterator)
}